The present invention relates to a portable electronic device, such as a so-called IC card, which incorporates an IC (integrated circuit) chip having a nonvolatile data memory and a control element, such as a CPU (Central Processing Unit).
In recent years, an IC card incorporating an IC chip having a nonvolatile data memory and a control element such as a CPU has been developed as a new portable data storage medium. The IC card reads, writes, or erases data with respect to the incorporated data memory by the internal control element. The control element normally performs a control operation by means of an internal control program. More specifically, when instruction data is input from an external device, the control element executes a decrypting program in the control program, and searches and executes a function program corresponding to the input instruction data. Thereafter, the control element outputs the result as response data to the external device.
In the conventional IC card, the function program is stored in a program memory comprising a mask ROM in or outside the control element. For this reason, if the function program for decrypting data is stored in the IC card, the encrypting method cannot be modified. When individual encrypting methods are to be adopted in accordance with demands of users, a control program for each different demand must be incorporated in the IC card, thus interfering with mass production. In this case, the user must present an encrypting method to a card manufacturer. Therefore, strong demand has arisen for a technique for storing and executing a new function program in addition to the already stored function program.